import request from "@/utils/request";

/**
 * 获取评论
 * @param orderType
 * @returns {Promise<AxiosResponse<any>> | *}
 */
export function getCommentList(orderType) {
  return request({
    url: '/user/comment',
    method: 'get',
    params: {
      orderType
    }
  })
}

/**
 * 添加评论
 */
export function addComment(data) {
  return request({
    url: '/user/comment',
    method: 'put',
    data
  })
}

/**
 * 回复评论
 */
export function replyComment(data) {
  return request({
    url: '/user/commentReply',
    method: 'put',
    data
  })
}

/**
 * 点赞主评论
 */
export function upvoteComment(id){
  return request({
    url: `/user/comment/${id}`,
    method: 'post',
  })
}

/**
 * 点赞回复评论
 */
export function upvoteReply(id){
  return request({
    url: `/user/commentReply/${id}`,
    method: 'post',
  })
}
